package com.example.baselibrary.utils

import android.app.Activity

object ActivityCollector {

    private val activites = ArrayList<Activity>()

    fun addActivity(activity: Activity){
        activites.add(activity)
    }

    fun removeActivity(activity: Activity){
        if (activites.contains(activity)){
            activites.remove(activity)
        }
    }

    fun finishAll(){
        for (activite in activites) {
            if (!activite.isFinishing){
                activite.finish()
            }
        }
        activites.clear()
    }
}